package com.zego.wawaji.ui.wawa.synth.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONObject;

/**
 * 合成娃娃
 * Created by Su on 2018/3/6.
 */
public class Synth extends BaseData implements Parcelable {
    private long id;
    private String name;
    private String img;
    private String bigImg;
    private String remark;

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);

        this.id = jsonObject.optLong("Id");
        this.name = jsonObject.optString("Name");
        this.img = jsonObject.optString("Img");
        this.remark = jsonObject.optString("Remark");
        this.bigImg = jsonObject.optString("BigImg");
    }

    /**
     * 是否合成娃娃成功
     *
     * @return true ： 成功
     */
    public boolean isSuccess() {
        return id > 0;
    }

    public String getBigImg() {
        return bigImg;
    }

    public String getName() {
        return name;
    }

    public String getImg() {
        return img;
    }

    public String getRemark() {
        return remark;
    }

    public Synth() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.id);
        dest.writeString(this.name);
        dest.writeString(this.img);
        dest.writeString(this.bigImg);
        dest.writeString(this.remark);
    }

    protected Synth(Parcel in) {
        this.id = in.readLong();
        this.name = in.readString();
        this.img = in.readString();
        this.bigImg = in.readString();
        this.remark = in.readString();
    }

    public static final Creator<Synth> CREATOR = new Creator<Synth>() {
        @Override
        public Synth createFromParcel(Parcel source) {
            return new Synth(source);
        }

        @Override
        public Synth[] newArray(int size) {
            return new Synth[size];
        }
    };
}
